<@app.html>
    <@app.head>
    <script>
        $(function () {
            $('#page_table').datagrid({
                fit: true,
                width: '100%',
                height: '100%',
                striped: true,
                pagination: true,
                fitColumns: true,
                pageSize: 10,
                pageList: [10, 50, 100],
                idField: 'batteryId',
                singleSelect: true,
                selectOnCheck: false,
                checkOnSelect: false,
                autoRowHeight: false,
                rowStyler: gridRowStyler,
                columns: [
                    [
                        {
                            title: '电池序号',
                            align: 'center',
                            field: 'batteryId',
                            width: 80
                        },
                        {
                            title: '电池电量(SOC)',
                            align: 'center',
                            field: 'batteryVolume',
                            formatter: function (val, row) {
                                if (val == null) {
                                    return '';
                                }
                                return val + '%';
                            },
                            width: 60
                        },
                        {
                            title: '电池剩余电量',
                            align: 'center',
                            field: 'dumpEnergy',
                            formatter: function (val, row) {
                                return (val / 100).toFixed(2);
                            },
                            width: 60
                        },
                        {
                            title: '经纬度',
                            align: 'center',
                            field: 'lng',
                            formatter: function (val, row) {
                                if (val == null) {
                                    return '';
                                }
                                return (row.lng).toFixed(6) + '/' + (row.lat).toFixed(6);
                            },
                            width: 80
                        },
                        {
                            title: '速度',
                            align: 'center',
                            field: 'speed',
                            formatter: function (val) {
                                if (val == null) {
                                    return '';
                                }
                                return (val).toFixed(2) + 'km/h';
                            },
                            width: 40
                        },
                        {
                            title: '上传频率',
                            align: 'center',
                            field: 'reportInterval',
                            formatter: function (val) {
                                if (val == null) {
                                    return '';
                                }
                                return val + 's';
                            },
                            width: 50
                        },
                        {
                            title: '上传间隔骑行里程',
                            align: 'center',
                            field: 'distance',
                            formatter: function (val) {
                                if (val == null || val == '') {
                                    return '';
                                }
                                return val + 'm';
                            },
                            width: 60
                        },
                        {
                            title: '上传间隔消耗电量',
                            align: 'center',
                            field: 'electricity',
                            formatter: function (val, row) {
                                return (val / 100).toFixed(2);
                            },
                            width: 60
                        },
                        {
                            title: '保护状态',
                            align: 'center',
                            field: 'protectionStatusName',
                            width: 80
                        },
                        {
                            title: '电池温度(℃)',
                            align: 'center',
                            field: 'ntcTemperature',
                            width: 60
                        },
                        {
                            title: '上传时间',
                            align: 'center',
                            field: 'createTime',
                            width: 100
                        }
                    ]
                ],
                onLoadSuccess: function () {
                    $('#page_table').datagrid('clearChecked');
                    $('#page_table').datagrid('clearSelections');
                }
            });
        });

        function query(){
            var queryLogTime = $('#query_log_time').datebox('getValue');
            var batteryId = $('#batteryId').val();
            if(queryLogTime == null || queryLogTime == '' ){
                $.messager.alert('提示信息', '请选择时间', '提示');
                return;
            }

            var datagrid = $('#page_table');
            datagrid.datagrid('options').url = "${contextPath}/security/hdw/unregister_battery_report_log/page.htm";
            datagrid.datagrid('options').queryParams = {
                queryLogTime: queryLogTime,
                batteryId: batteryId
            };
            datagrid.datagrid('load');
        }
        $(function () {
            $('#batteryId').keydown(function (event) {
                if (event.keyCode == 13) {
                 query();
                }
            });
        })
    </script>
    </@app.head>
    <@app.body>
        <@app.container>
            <@app.banner/>
        <div class="main">
            <@app.menu/>
            <div class="content">
                <div class="panel search">
                    <div class="float_right">
                    </div>
                    <table cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td align="right" width="80">日志日期：</td>
                            <td><input type="text" class="easyui-datebox" id="query_log_time"  style="height: 28px;"/></td>
                            <td align="right" width="60">电池序号：</td>
                            <td><input type="text" class="text" id="batteryId"/>&nbsp;&nbsp;</td>
                            <td><button class="btn btn_red" onclick="query()">查询</button></td>
                        </tr>
                    </table>
                </div>
                <div class="panel grid_wrap">
                    <div class="toolbar clearfix">
                        <h3>未注册电池上报日志</h3>
                    </div>
                    <div class="grid">
                        <table id="page_table"></table>
                    </div>
                </div>
            </div>
        </div>
        </@app.container>
    </@app.body>
</@app.html>